package com.ruoyi.business.domain;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 店铺订单管理对象 order
 *
 * @author xiao
 * @date 2024-09-11
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "orders", shards = 3, replicas = 2)//指定类映射的索引库名+分片备份数量
public class Orders extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 订单号
     */
    @Excel(name = "订单号")
    @Id //表示当前属性为主键
    private Long id;

    /**
     * 核销码【UUID产生、唯一】
     */
    /*
     * @Field注解：字段映射
     *   name：映射的es中字段名称 【可以省略】
     *   type：类型
     *       Text字符串 会分词
     *       type = FieldType.Keyword , analyzer = "ik_max_word"  不分词
     *   analyzer：配置分词器
     * */
    @Field(name = "verificationCode", type = FieldType.Keyword)
    @Excel(name = "核销码【UUID产生、唯一】")
    private String verificationCode;

    /**
     * 核销码图片
     */
    @Excel(name = "核销码图片")
    @Field(name = "verificationImg", type = FieldType.Keyword)
    private String verificationImg;

    /**
     * 店铺id
     */
    @Field(name = "mId", type = FieldType.Long)
    private Long mId;

    /**
     * 用户id
     */
    @Field(name = "uId", type = FieldType.Long)
    private Long uId;

    /**
     * 服务详情编号id
     */
    @Field(name = "serviceId", type = FieldType.Long)
    private Long serviceId;

    /**
     * 服务类别id
     */
    @Field(name = "serviceTypeId", type = FieldType.Long)
    private Long serviceTypeId;

    /**
     * 下单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Field(name = "orderTime", type = FieldType.Date)
    private Date orderTime;

    /**
     * 预约时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "预约时间", width = 30, dateFormat = "yyyy-MM-dd")
    @Field(name = "reservationTime", type = FieldType.Date)
    private Date reservationTime;

    /**
     * 订单车辆id号
     */
    @Field(name = "carId", type = FieldType.Long)
    private Long carId;

    /**
     * 平台优惠卷id
     */
    @Field(name = "platformCouponId", type = FieldType.Long)
    private Long platformCouponId;

    /**
     * 商家优惠卷id
     */
    @Field(name = "shopCouponId", type = FieldType.Long)
    private Long shopCouponId;

    /**
     * 实付价格
     */
    @Field(name = "price", type = FieldType.Float)
    @Excel(name = "实付价格")
    private Float price;

    /**
     * 支付时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Field(name = "payTime", type = FieldType.Keyword)
    private String payTime;

    /**
     * 使用时间
     */
    @Field(name = "useTime", type = FieldType.Date)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date useTime;

    /**
     * 订单状态（0待支付 1待使用 2待评价 3已取消 4已退款 5已完成 ）
     */
    @Field(name = "status", type = FieldType.Integer)
    @Excel(name = "订单状态", readConverterExp = "0=待支付,1=待使用,2=待评价,3=已取消,4=已退款,5=已完成")
    private Integer status;

    /**
     * 删除状态
     */
    @Field(name = "deleted", type = FieldType.Integer)
    private Integer deleted;

    //    店铺名
    @Field(name = "sName", type = FieldType.Keyword)
    private String sName;

    //    用户名
    @Field(name = "ivName", type = FieldType.Keyword)
    private String ivName;

    //    服务类型名
    @Field(name = "stName", type = FieldType.Keyword)
    private String stName;

    //    服务详情名
    @Field(name = "sdName", type = FieldType.Keyword)
    private String sdName;

}
